package de.lns.entities.effect;

import de.lns.entities.Entity;
import de.lns.level.Level;
/**
 * 
 * @author Jascha
 *
 */
public abstract class DependentEffect extends Effect{
	
	protected Entity dentity;
	/**
	 * 
	 * @return The entity this effect is dependent on.
	 */
	public Entity getDentity() {
		return dentity;
	}
	/**
	 * 
	 * @param dentity The entity this effect should be dependent on.
	 */
	public void setDentity(Entity dentity) {
		this.dentity = dentity;
	}
	/**
	 * 
	 * @param entity The entity this effect should be applied to.
	 * @param dentity The entity this effect should be dependent on.
	 */
	public DependentEffect( Effectable entity, Entity dentity) {
		super(entity);
		this.dentity=dentity;
	}
	@Override
	/**
	 * Checks if the dependent entity is still existing if it doesn't it removes this effect.
	 */
	public void update(){
		if(Level.getEntityList().contains(dentity)){
			
		}
		else{
			entity.removeEffect(this);
		}
			
	}
	
	
	
}